Skip to content

Automatically convert spaces to dashes in branch names#2916

Open
pBouillon wants to merge 1 commit intogitui-org:masterfrom
pBouillon:feature/auto-replace-spaces-in-branch-name
Open

Automatically convert spaces to dashes in branch names#2916
pBouillon wants to merge 1 commit intogitui-org:masterfrom
pBouillon:feature/auto-replace-spaces-in-branch-name

Conversation

@pBouillon
Copy link
Copy Markdown

@pBouillon pBouillon commented Apr 23, 2026

This Pull Request does not close an existing issue.

It changes the following:

  • Spaces typed in the branch name input are automatically converted to dashes, keeping branch names valid without requiring the user to type dashes manually
  • This applies to both the create branch and rename branch popups

This behavior is consistent with how VS Code handles branch name creation, and with how lazygit handles it too. For instance, here's how the branch creation popup is displayed in VS Code:

vscode branch creation example

I'm a long-time gitui user and genuinely love the project but, as I used different tools as part of my professional and personal workflow, this is a small quality-of-life feature I kept missing when coming from other git tools, especially when the issue name is quite long.

I'm not familiar with Rust and wasn't able to set up the toolchain locally, so rather than testing manually I enabled GitHub Actions on my fork and made sure the full CI pipeline passed. Given my limited Rust experience, I may have missed something or done things in a non-idiomatic way. Please let me know if you feel like any change is needed here.

I followed the checklist:

  • I added unittests
  • I ran make check without errors
  • I tested the overall application
  • I added an appropriate item to the changelog

}
}

const fn normalize_branch_name_char(c: char) -> char {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets not duplicate this code

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, where would you like it being moved to in order to keep things organized in the repo?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants